﻿﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common;


namespace Core
{
    public class CountryRepository : RepositoryBase<Country, int>, ICountryRepository
    {
        private readonly ICache _Cache;

        public CountryRepository(IDbContext context,
            ICache _cache)
            : base(context)
        {
            _Cache = _cache;
        }

        public override IEnumerable<Country> GetAll()
        {
            return _Cache.Get(Settings.AllCountryKey, () =>
            {
                return DbSet.Where(c => c.IsActive);
            }, 60);
        }

    }
}